<template>
    <h2>这是父组件</h2>
    <button @click="changeChildUpper">从父组件改变子组件大小写</button>
 <ChildComponent ref="childRef" />
 
</template>

<script setup>
import { ref } from 'vue';
import ChildComponent from './ChildComponent.vue';

function changeChildUpper() {
    if (childRef.value) {
        var _childRef =childRef;
        _childRef.value.changeUpperMessage();
  }
 

}

const childRef = ref(null);
</script>

<style>

</style>